package com.secret.chain.secretchain.controller.wx;

import com.secret.chain.secretchain.domain.entity.Article;
import com.secret.chain.secretchain.domain.entity.Like;
import com.secret.chain.secretchain.result.Result;
import com.secret.chain.secretchain.service.ArticleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/wx/article")
public class ArticleController {
    @Autowired
    private ArticleService articleService;
    @GetMapping("{id}")
    public Result<Article> queryById(@PathVariable Integer id){
        Result<Article> result = articleService.queryById(id);
        return result;
    }
    @DeleteMapping
    public Result delete(Integer id){
        return articleService.deleted(id);
    }
     @PostMapping("/save")
    public Result<Void>   save(@RequestBody Article article){
        return articleService.save(article);
    }
     @PutMapping
    public Result put(@RequestBody Article article){
        return articleService.put(article);
    }

    @PostMapping("/like")
    public Result<Void>   add(@RequestBody Like like){
    return articleService.add(like);
    }
}